package cn.bandeqing.order.controller;

import cn.bandeqing.base.resp.Resp;
import cn.bandeqing.order.req.OrderDetailReq;
import cn.bandeqing.order.resp.OrderDetailResp;
import cn.bandeqing.wechatminiapp.req.MonthOrderReq;
import cn.bandeqing.wechatminiapp.req.OrderAppointmentReq;
import cn.bandeqing.wechatminiapp.req.OrderListReq;
import cn.bandeqing.wechatminiapp.resp.MonthOrderResp;
import cn.bandeqing.wechatminiapp.resp.OrderListResp;
import cn.bandeqing.wechatminiapp.rpc.IWechatMiniAppRpc;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/order")
@RestController
@Tag(name = "订单")
public class OrderController {

    @DubboReference
    private IWechatMiniAppRpc wechatMiniAppRpc;

//    public Resp<List<OrderListResp>> da

    @Operation(summary = "月份订单分布")
    @PostMapping("/monthOrder")
    public Resp<List<MonthOrderResp>> monthOrder(@RequestBody @Valid MonthOrderReq req) {
        return wechatMiniAppRpc.monthOrder(req);
    }

    @Operation(summary = "预约")
    @PostMapping("/appointment")
    public Resp<Void> appointment(@RequestBody @Valid OrderAppointmentReq req) {
        return wechatMiniAppRpc.appointment(req);
    }

    @Operation(summary = "订单详情")
    @PostMapping("/detail")
    public Resp<OrderDetailResp> detail(@RequestBody @Valid OrderDetailReq req) {
        return wechatMiniAppRpc.detail(req);
    }

    @Operation(summary = "订单列表")
    @PostMapping("/list")
    public Resp<List<OrderListResp>> list(@RequestBody @Valid OrderListReq req) {
        return wechatMiniAppRpc.list(req);
    }

}
